using System;
using System.Collections.Generic;

namespace SY.WebSite.Entity
{
	/// <summary>
	///	
	/// </summary>
	[Serializable]
	public class Integration : IEntity
	{
		public const string RESERVE_CONST = "Integration";
			
		#region Private Members
		private int _id; 
		private string _userName; 
		private int _honor; 
		private int _available; 
		private int _freeze; 
		private int _used; 
		private string _security; 		
		[NonSerialized]
        private string _reserve;
		#endregion
		
		#region Default ( Empty ) Class Constuctor
		/// <summary>
		/// default constructor
		/// </summary>
		public Integration()
		{
			_id = 0; 
			_userName = null; 
			_honor = 0; 
			_available = 0; 
			_freeze = 0; 
			_used = 0; 
			_security = null; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor
		
		public Dictionary<string, object> ToDictionary()
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
		
			dictionary.Add("Id",_id);
			dictionary.Add("UserName",_userName);
			dictionary.Add("Honor",_honor);
			dictionary.Add("Available",_available);
			dictionary.Add("Freeze",_freeze);
			dictionary.Add("Used",_used);
			dictionary.Add("Security",_security);
			
			dictionary.Add("Reserve",Reserve);//特殊
			return dictionary;
		}
		
		#region Public Properties
		/// <summary>
		/// 
		/// </summary>		
		public int Id
		{
			get { return _id; }
			set { _id = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string UserName
		{
			get { return _userName; }
			set	
			{
				if( value!= null && value.Length > 16)
					throw new ArgumentOutOfRangeException(@"Invalid value for UserName", value, value);
				
				_userName = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Honor
		{
			get { return _honor; }
			set { _honor = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Available
		{
			get { return _available; }
			set { _available = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Freeze
		{
			get { return _freeze; }
			set { _freeze = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Used
		{
			get { return _used; }
			set { _used = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Security
		{
			get { return _security; }
			set	
			{
				if( value!= null && value.Length > 64)
					throw new ArgumentOutOfRangeException(@"Invalid value for Security", value, value);
				
				_security = value;
			}
		}
			
		/// <summary>
        /// 保留属性
        /// </summary>
        public string Reserve
        {
            get 
            {
                if (string.IsNullOrEmpty(_reserve))
                    return RESERVE_CONST  ;

                return _reserve; 
            }
            set { _reserve = value; }
        }
		#endregion 
	}
}
